import {createRouter, createWebHashHistory} from 'vue-router'
import Layout from '@/layout/index.vue'
/* Router Modules */
import charts from './modules/charts'
import guid from './modules/guid'
import excel from './modules/excel'
import directive from './modules/directive'
import table from './modules/table'
import BasicDemo from "@/router/modules/basic-demo";

export const constantRoutes = [
    {
        path: '/redirect',
        component: Layout,
        hidden: true,
        children: [
            {
                path: '/redirect/:path(.*)',
                component: () => import('@/views/redirect')
            }
        ]
    },
    {
        path: '/login',
        component: () => import('@/views/login/index.vue'),
        hidden: true
    },
    {
        path: '/register',
        component: () => import('@/views/login/register.vue'),
        hidden: true
    },
    {
        path: '/404',
        component: () => import('@/views/error-page/404.vue'),
        hidden: true
    },
    {
        path: '/401',
        component: () => import('@/views/error-page/401.vue'),
        hidden: true
    },
    {
        path: '/',
        component: Layout,
        redirect: '/index',
        children: [
            {
                path: 'index',
                name: 'Dashboard',
                component: () => import('@/views/dashboard/index.vue'),
                //using el svg icon, the elSvgIcon first when at the same time using elSvgIcon and icon
                meta: {title: 'Dashboard', elSvgIcon: 'Fold', affix: true}
            }
        ]
    },
    // guid,
    // charts,
    // excel,
    // directive,
    table,
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = []
export const noMathPage = {path: '/:pathMatch(.*)', redirect: '/404', hidden: true}
const router = createRouter({
    history: createWebHashHistory(),
    scrollBehavior: () => ({top: 0}),
    routes: constantRoutes,
})


export default router
